// pages/pending-invoice/pending-invoice.js
Page({
  data: {
    invoiceList: [
      {
        id: '001',
        type: '门诊费用',
        amount: '128.50',
        date: '2025-01-15',
        department: '内科',
        doctor: '张医生'
      },
      {
        id: '002',
        type: '检查费用',
        amount: '256.00',
        date: '2025-01-10',
        department: '放射科',
        doctor: '李医生'
      },
      {
        id: '003',
        type: '药品费用',
        amount: '89.30',
        date: '2025-01-08',
        department: '药房',
        doctor: '王医生'
      },
      {
        id: '004',
        type: '治疗费用',
        amount: '156.80',
        date: '2025-01-05',
        department: '外科',
        doctor: '陈医生'
      }
    ]
  },

  onLoad: function(options) {
    // 页面加载时的逻辑
  },

  // 选择发票
  selectInvoice: function(e) {
    const invoiceId = e.currentTarget.dataset.id;
    const invoice = this.data.invoiceList.find(item => item.id === invoiceId);
    
    wx.navigateTo({
      url: `/pages/select-time/select-time?invoiceId=${invoiceId}&type=${invoice.type}&amount=${invoice.amount}&date=${invoice.date}&department=${invoice.department}&doctor=${invoice.doctor}`
    });
  }
});

